package com.example.product.api.client;

import com.example.common.domain.Result;
import com.example.product.domain.dto.ItemDTO;
import com.example.product.domain.vo.ProductVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(name = "product-service")
public interface ProductClient {
    @GetMapping("/product/info")
    Result<Map<Long, ProductVO>> getProduct(@RequestParam("ids") List<Long> ids);

    @PutMapping("/product/stock/deduct")
    Result deductStock(List<ItemDTO> itemDTO);

    @PutMapping("/product/restoreStock")
    Result restoreStock(@RequestParam Integer skuId,@RequestParam Integer num);
}
